/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package telas;

import javax.swing.JTable;
import vacina.Vacina;
import vacina.VacinaDAO;
import vacina.VacinaModal;

/**
 *
 * @author Max Weber
 */
public class O11AvisoExcluirVacina extends javax.swing.JDialog {
    private Vacina vacina;
    private JTable tabela;

    /**
     * Creates new form O7AvisoExcluirVacina2
     */
    public O11AvisoExcluirVacina() {
        initComponents();
    }
    public O11AvisoExcluirVacina(Vacina vacina, JTable tabela) {
        initComponents();
        setModal(true);
        this.vacina = vacina;
        this.tabela = tabela;
        tfNome.setText(vacina.getNome_vacina());
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        bgSaiu = new javax.swing.JLabel();
        bgEntrou = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        tfNome = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        painelSim = new javax.swing.JPanel();
        btSim = new javax.swing.JLabel();
        painelNao = new javax.swing.JPanel();
        btNao = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        bgSaiu.setBackground(new java.awt.Color(10, 66, 108));
        bgSaiu.setText("jLabel4");

        bgEntrou.setBackground(new java.awt.Color(68, 165, 237));
        bgEntrou.setText("jLabel4");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setBackground(new java.awt.Color(0, 114, 180));
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jPanel1MousePressed(evt);
            }
        });

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        tfNome.setBackground(new java.awt.Color(240, 240, 240));
        tfNome.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
        tfNome.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        tfNome.setToolTipText("");
        tfNome.setBorder(null);
        tfNome.setEnabled(false);
        jPanel2.add(tfNome, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 300, 30));

        jLabel4.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel4.setText("Deseja excluir esta vacina?");
        jPanel2.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 30, -1, -1));

        painelSim.setBackground(new java.awt.Color(10, 66, 108));
        painelSim.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                painelSimMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                painelSimMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                painelSimMouseExited(evt);
            }
        });
        painelSim.setLayout(new java.awt.GridBagLayout());

        btSim.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
        btSim.setForeground(new java.awt.Color(255, 255, 255));
        btSim.setText("Sim");
        btSim.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btSim.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btSimMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btSimMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btSimMouseExited(evt);
            }
        });
        painelSim.add(btSim, new java.awt.GridBagConstraints());

        jPanel2.add(painelSim, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 110, 80, 30));

        painelNao.setBackground(new java.awt.Color(10, 66, 108));
        painelNao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                painelNaoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                painelNaoMouseExited(evt);
            }
        });
        painelNao.setLayout(new java.awt.GridBagLayout());

        btNao.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
        btNao.setForeground(new java.awt.Color(255, 255, 255));
        btNao.setText("Não");
        btNao.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btNao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btNaoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btNaoMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btNaoMouseExited(evt);
            }
        });
        painelNao.add(btNao, new java.awt.GridBagConstraints());

        jPanel2.add(painelNao, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 110, 80, 30));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Attention-32.png"))); // NOI18N
        jPanel2.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icone_barraDeTit.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)
                        .addGap(3, 3, 3))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addComponent(jLabel3)
                .addGap(3, 3, 3)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                .addGap(3, 3, 3))
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 330, 190));

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btSimMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btSimMouseClicked
        VacinaDAO dao = new VacinaDAO();
        dao.remover(vacina);
        
        VacinaModal ltm = new VacinaModal(dao.listar());
        tabela.setModel(ltm);
        dispose();
    }//GEN-LAST:event_btSimMouseClicked

    private void painelSimMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelSimMouseClicked
        // TODO add your handling code here:
        
    }//GEN-LAST:event_painelSimMouseClicked

    private void btNaoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNaoMouseClicked
        dispose();
    }//GEN-LAST:event_btNaoMouseClicked

    private void jPanel1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MousePressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jPanel1MousePressed

    private void btSimMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btSimMouseEntered
        // TODO add your handling code here:
        painelSim.setBackground(bgEntrou.getBackground());
    }//GEN-LAST:event_btSimMouseEntered

    private void painelSimMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelSimMouseEntered
        // TODO add your handling code here:
        painelSim.setBackground(bgEntrou.getBackground());
    }//GEN-LAST:event_painelSimMouseEntered

    private void btNaoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNaoMouseEntered
        // TODO add your handling code here:
        painelNao.setBackground(bgEntrou.getBackground());
    }//GEN-LAST:event_btNaoMouseEntered

    private void painelNaoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelNaoMouseEntered
        // TODO add your handling code here:
        painelNao.setBackground(bgEntrou.getBackground());
    }//GEN-LAST:event_painelNaoMouseEntered

    private void btSimMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btSimMouseExited
        // TODO add your handling code here:
        painelSim.setBackground(bgSaiu.getBackground());
    }//GEN-LAST:event_btSimMouseExited

    private void painelSimMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelSimMouseExited
        // TODO add your handling code here:
        painelSim.setBackground(bgSaiu.getBackground());
    }//GEN-LAST:event_painelSimMouseExited

    private void btNaoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNaoMouseExited
        // TODO add your handling code here:
        painelNao.setBackground(bgSaiu.getBackground());
    }//GEN-LAST:event_btNaoMouseExited

    private void painelNaoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_painelNaoMouseExited
        // TODO add your handling code here:
        painelNao.setBackground(bgSaiu.getBackground());
    }//GEN-LAST:event_painelNaoMouseExited

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(O11AvisoExcluirVacina.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(O11AvisoExcluirVacina.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(O11AvisoExcluirVacina.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(O11AvisoExcluirVacina.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new O11AvisoExcluirVacina().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel bgEntrou;
    private javax.swing.JLabel bgSaiu;
    private javax.swing.JLabel btNao;
    private javax.swing.JLabel btSim;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel painelNao;
    private javax.swing.JPanel painelSim;
    private javax.swing.JTextField tfNome;
    // End of variables declaration//GEN-END:variables

    
}
